﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using KPIS.GERP.ESS.BLL;
using KPIS.GERP.ESS.MODEL;

namespace KPIS.GERP.ESS.SERVICE
{
    /// <summary>
    /// Summary description for Service1
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    // [System.Web.Script.Services.ScriptService]
    public class MessageSend : System.Web.Services.WebService
    {
        B_MessageSend bll = new B_MessageSend();

        [WebMethod]
        public List<M_MessageSend> GetFull(string to_user_seq
            , string from_user_seq, string message_status, string ref_type, string ref_seq)
        {
            return bll.GetFull(to_user_seq, from_user_seq, message_status, null, ref_type, ref_seq);
        }

        [WebMethod]
        public List<M_MessageSend> GetList(string to_user_seq
            , string from_user_seq, string message_status)
        {
            return bll.GetList(to_user_seq, from_user_seq, message_status);
        }

        [WebMethod]
        public string SelectRecentInsertedRoleSeq()
        {
            return bll.SelectRecentInsertedRoleSeq();
        }

        [WebMethod]
        public M_MessageSend GetInfo(string seq)
        {
            return bll.GetInfo(seq);
        }

        [WebMethod]
        public M_MessageSend GetInfoFromRefSeq(string ref_seq, string ref_type)
        {
            return bll.GetInfoFromRefSeq(ref_seq, ref_type);
        }

        [WebMethod]
        public int GetUnreadCount(string emp_seq)
        {
            return bll.GetUnreadCount(emp_seq);
        }

        [WebMethod]
        public DataTable GetCurrentApprover(string emp_seq, string process, int step_no)
        { 
            return bll.GetCurrentApprover(emp_seq, null, process, step_no);
        }

        [WebMethod]
        public M_MessageSend GetInfoFromFromSendSeq(string seq)
        {
            return bll.GetInfoFromFromSendSeq(seq);
        }

        [WebMethod]
        public DataTable GetEmployeeInPositionGroup(string PosGrpSeq)
        {
            return bll.GetEmployeeInPositionGroup(PosGrpSeq);
        }

        [WebMethod]
        public void Insert(M_MessageSend info)
        {
            try
            {
                bll.Insert(info);
            }
            catch
            {
                throw;
            }
        }

        [WebMethod]
        public void Update(M_MessageSend info)
        {
            try
            {
                bll.Update(info);
            }
            catch
            {
                throw;
            }
        }

        [WebMethod]
        public void Delete(M_MessageSend info)
        {
            try
            {
                bll.Delete(info);
            }
            catch
            {
                throw;
            }
        }

        [WebMethod]
        public void UpdateMessageStatus(M_MessageSend info)
        {
            try
            {
                bll.UpdateMessageStatus(info);
            }
            catch
            {
                throw;
            }
        }
    }
}
